<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'health/diagnosis/inspct/inspectparam',
      // Web路径
      webPath: 'health/diagnosis/Inspct/InspectParam',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "name",
              name: "名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "inspectionCode",
              name: "检查项目编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "inspectionName",
              name: "检查项目名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "typeSign",
              name: "类型标识",
              span: 6,
              type: "text",
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "数值" }
                ]
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "code",
          name: "编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "name",
          name: "名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "inspectionCode",
          name: "检查项目编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "inspectionName",
          name: "检查项目名称",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "typeSign",
          name: "类型标识",
          span: 6,
          type: "text",
          config: {
            edit: false,
            keyField: "key",
            valueField: "value",
            options: [
              { key: "1", value: "数值" }
            ]
          }
        },
        {
          code: "upperLimit",
          name: "参考上限",
          span: 6,
          type: "number",
          config: {
            edit: false
          }
        },
        {
          code: "lowerLimit",
          name: "参考下限",
          span: 6,
          type: "number",
          config: {
            edit: false
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false,
                require: true
              }
            },
            {
              code: "name",
              name: "名称",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "inspectionCode",
              span: 6,
              name: "检查项目编码",
              type: "popup",
              config: {
                url: "health/diagnosis/inspct/inspct",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    inspectionName: row.name,
                    inspectionCode: row.code,
                    inspectionId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "inspectionName",
              name: "检查项目名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                require: false,
                disabled: true
              }
            },
            {
              code: "typeSign",
              name: "类型标识",
              span: 6,
              type: "text",
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "1", value: "数值" }
                ]
              }
            },
            {
              code: "upperLimit",
              name: "参考上限",
              span: 6,
              type: "number",
              config: {
                edit: false,
                precision: 2
              }
            },
            {
              code: "lowerLimit",
              name: "参考下限",
              span: 6,
              type: "number",
              config: {
                edit: false,
                precision: 2
              }
            }
          ]
        }
      ]
    }
  }
}
</script>
